﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Web_Company : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set the your details image to the header

        Session["key"] = "~/img/Process/3.png";


        //Disable All the Shipping Information (Non Editable Region)

        ShipTextBoxContactPerson.Enabled = false;
        ShipTextBoxAddress1.Enabled = false;
        ShipTextBoxAddress2.Enabled = false;
        ShipTextBoxTown.Enabled = false;
        ShipTextBoxZip.Enabled = false;
        ShipTextBoxPhoneNo.Enabled = false;
        ShipTextBoxMobileNo.Enabled = false;
        ShipTextBoxEmailAddress.Enabled = false;
        ShipComboBoxCountry.Enabled = false;
        ShipTextBoxStatePro.Enabled = false;

        //Disable All the Validation Part of Shipping Information

        RequiredFieldValidatorContactPerson.Enabled = false;
        RequiredFieldValidatorShipAddress1.Enabled = false;
        RequiredFieldValidatorShipTown.Enabled = false;
        RequiredFieldValidatorShipZip.Enabled = false;
        RequiredFieldValidatorShipPhone.Enabled = false;
        RequiredFieldValidatorShipMobile.Enabled = false;
        RequiredFieldValidatorShipEmail.Enabled = false;
        
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (!CheckBox1.Checked)
        {

            //Enable All the Shipment information after the check box is CHECKED !
            ShipTextBoxContactPerson.Enabled = true;
            ShipTextBoxAddress1.Enabled = true;
            ShipTextBoxAddress2.Enabled = true;
            ShipTextBoxTown.Enabled = true;
            ShipTextBoxZip.Enabled = true;
            ShipTextBoxPhoneNo.Enabled = true;
            ShipTextBoxMobileNo.Enabled = true;
            ShipTextBoxEmailAddress.Enabled = true;
            ShipComboBoxCountry.Enabled = true;
            ShipTextBoxStatePro.Enabled = true;

            //Enable All the Validation Part of the Shipping Information

            RequiredFieldValidatorContactPerson.Enabled = true;
            RequiredFieldValidatorShipAddress1.Enabled = true;
            RequiredFieldValidatorShipTown.Enabled = true;
            RequiredFieldValidatorShipZip.Enabled = true;
            RequiredFieldValidatorShipPhone.Enabled = true;
            RequiredFieldValidatorShipMobile.Enabled = true;
            RequiredFieldValidatorShipEmail.Enabled = true;
        }
    }

    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        Bestlife.ERP.Entities.E_Company com=new Bestlife.ERP.Entities.E_Company();
        try
        {

            com.Dis_Id1 = TextBoxComanyID.Text;
            com.Company_Name1 = TextBoxComanyName1.Text;
            com.Company_Status1 = TextBoxComanyStatus.Text;
            com.Che_Name1 = TextBoxChkName.Text;
            com.Contact_Person1 = TextBoxContactPerson1.Text;
            com.Position1 = TextBoxPossition.Text;
            com.Address11 = TextBoxAddress1.Text;
            com.Address21 = TextBoxAddress2.Text;
            com.Town1 = TextBoxTown.Text;
            com.State1 = TextBoxState.Text;
            com.Zip_Code1 = int.Parse(TextBoxZip.Text);
            com.Country1 = ComboBoxCountry.SelectedValue.ToString();
            com.Home_Phone1 = TextBoxHome.Text;
            com.Fax_No1 = TextBoxFaxNo.Text;
            com.Mobile_Phone_No1 = TextBoxMobile.Text;
            com.Email1 = TextBoxEmailAddress.Text;
            com.Type_Of_Bussiness1 = TextBoxTypeOfBussiness.Text;
            com.Valid_Id1 = TextBoxValidIDNo.Text;
            com.Reg_Date1 = TextBoxRegistedDate.Text;
            com.Reg_Country1 = TextBoxRegistedCountry.Text;
            com.Ship_Contact1 = ShipTextBoxContactPerson.Text;
            com.Ship_Address11 = ShipTextBoxAddress1.Text;
            com.Ship_Address21 = ShipTextBoxAddress2.Text;
            com.Ship_Town1 = ShipTextBoxTown.Text;
            com.Ship_State1 = ShipTextBoxStatePro.Text;
            com.Ship_Zip_Code1 = ShipTextBoxZip.Text;
            com.Ship_Country1 = ShipComboBoxCountry.Text;
            com.Ship_Phone1 = ShipTextBoxPhoneNo.Text;
            com.Ship_Mobile1 = ShipTextBoxMobileNo.Text;
            com.Ship_Email1 = ShipTextBoxEmailAddress.Text;
            com.Language1 = TextBoxLanguage.Text;
            com.Security_Question1 = ComboBoxSecurityQ.SelectedValue.ToString();
            com.Answer1 = TextBoxSAnswer.Text;
            com.Security_Word1 = TextBoxSWord.Text;
            com.BCrown_Pin1 = TextBoxQAPinNo.Text;
            com.Password1 = TextBoxPassword.Text;
            com.URL1 = URL.Text;

            Bestlife.ERP.DataAccess.D_Company.addTenant(com);
            LabelMessage.Text = "Your Details are Successfully Inserted, Thank You !";
        }
        catch (Exception) { 
        
        }
    }
}